//
//  NameSexView.m
//  ShanMei
//
//  Created by huazi on 15/3/12.
//  Copyright (c) 2015年 huazi. All rights reserved.
//

#import "NameSexView.h"

@implementation NameSexView

- (id)initWithFrame:(CGRect)frame
{
    if (self =[super initWithFrame:frame])
    {
        self.labelName =[[UILabel alloc] initWithFrame:CGRectZero];
        self.labelName.font =themeFont15;
        [self addSubview:self.labelName];
        self.imageSex =[[UIImageView alloc] init];
        [self addSubview:self.imageSex];
    }
    return self;
}
- (void)setTextName:(NSString *)textName
{
    float width =[NSString calculateTextWidth:150.0 Content:textName font:themeFont15];
    self.labelName.frame =CGRectMake(0, 0, MIN(width, 150), self.frame.size.height);
    self.labelName.text =textName;
}
- (void)setSex:(NSString *)sex
{
    self.imageSex.frame =CGRectMake(self.labelName.frame.size.width +10, (self.frame.size.height-13)/2, 13, 13);
    if ([sex isEqualToString:@"1"])
    {
        self.imageSex.image =[UIImage imageNamed:@"WoMale"];
    }
    else if([sex isEqualToString:@"2"])
    {
        self.imageSex.image =[UIImage imageNamed:@"WoFemale"];
    }
    else
    {
        self.imageSex.image =[UIImage imageNamed:@"WoMale"];
    }
}
@end
